<?php
header("Content-Type: text/html; charset=utf-8");
include_once ("smarty_header.php");


if($_POST['tijiao'] != "生成"){
	$smarty->display ( "index.html" );
}
elseif ($_POST['tijiao'] == "生成"){
	if($_POST['begin'] == '' && $_POST['end'] == ''){
		$smarty->assign ( "begin", 0 );
		$smarty->assign ( "end", 100 );
		//生成0到100的随机数
		$ret = rand(0,100);		
	}
	else{
		$smarty->assign ( "begin", $_POST['begin']>$_POST['end']?$_POST['end']: $_POST['begin']);
		$smarty->assign ( "end", $_POST['begin']<$_POST['end']?$_POST['end']: $_POST['begin'] );
		//生成begin到end的随机数
		$ret = rand($_POST['begin'],$_POST['end']);	
	}
	$smarty->assign ( "ret", $ret );
	$smarty->display ( "index.html" );
}

?>